package org.example.maven.controller;

import org.example.maven.pojo.Result;
import org.example.maven.service.EraService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@CrossOrigin
@RequestMapping("/era")
public class eraController {
    @Autowired
    private EraService eraService;
    @GetMapping
    //获取年代单选框的年代信息
    @PreAuthorize("permitAll()")
    public Result getAllEra(){
        return Result.success(eraService.getAllEra());
    }

    //获取藏品年代
    @GetMapping("/getEraAnnular")
    @PreAuthorize("permitAll()")
    public Result getEraAnnular(){
        return Result.success(eraService.getEraByCollection());
    }
}
